home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / fratboy_.swf / scripts / DefineSprite_2047 / frame_1 / DoAction.as
Text File  |  2010-11-09  |  2KB  |  92 lines

  1. function blockMove()
  2. {
  3.    if(_root.pausee != true)
  4.    {
  5.       if(_root.delay != undefined)
  6.       {
  7.          if(_root.delay != this.d)
  8.          {
  9.             this.counter = 0;
  10.          }
  11.          if(_root.delay != undefined)
  12.          {
  13.             this.counter = this.counter + 1;
  14.          }
  15.          if(this.counter == _root.delay)
  16.          {
  17.             this.counter = 0;
  18.             this._x -= 0.5;
  19.          }
  20.          this.d = _root.delay;
  21.       }
  22.       if(this._x <= 0 && this.proshla != true)
  23.       {
  24.          this.proshla = true;
  25.          _root.creatureType = this.type;
  26.          _root.creatureGen(16);
  27.          _root.delay = 7;
  28.       }
  29.       if(this._x < -100)
  30.       {
  31.          this.swapDepths(99999);
  32.          this.removeMovieClip();
  33.       }
  34.    }
  35. }
  36. function generate(xx)
  37. {
  38.    a[0] = random(4) + 1;
  39.    a[1] = random(4) + 1;
  40.    while(a[1] == a[0])
  41.    {
  42.       a[1] = random(4) + 1;
  43.    }
  44.    a[2] = random(4) + 1;
  45.    while(a[2] == a[0] || a[2] == a[1])
  46.    {
  47.       a[2] = random(4) + 1;
  48.    }
  49.    a[3] = random(4) + 1;
  50.    while(a[3] == a[0] || a[3] == a[1] || a[3] == a[2])
  51.    {
  52.       a[3] = random(4) + 1;
  53.    }
  54.    i = 0;
  55.    while(i < 4)
  56.    {
  57.       this.attachMovie("crType" + a[i],"crType" + _root.creatureGroupNum + i,this.getNextHighestDepth(),{_x:xx + 91.5 * i,_y:-4});
  58.       eval("crType" + _root.creatureGroupNum + i).onEnterFrame = blockMove;
  59.       eval("crType" + _root.creatureGroupNum + i).type = a[i];
  60.       eval("crType" + _root.creatureGroupNum + i).counter = 0;
  61.       i++;
  62.    }
  63. }
  64. var a = new Array();
  65. counter = 0;
  66. a[4] = 1;
  67. a[5] = 2;
  68. a[6] = 3;
  69. a[7] = 4;
  70. i = 4;
  71. while(i < 8)
  72. {
  73.    this.attachMovie("crType" + a[i],"crType" + i,this.getNextHighestDepth(),{_x:0.1 + 91.5 * (i - 4),_y:-4});
  74.    eval("crType" + i).onEnterFrame = blockMove;
  75.    eval("crType" + i).type = a[i];
  76.    eval("crType" + i).counter = 0;
  77.    i++;
  78. }
  79. generate(366);
  80. this.onEnterFrame = function()
  81. {
  82.    if(eval("crType" + _root.creatureGroupNum + 0)._x < 0)
  83.    {
  84.       _root.creatureGroupNum = _root.creatureGroupNum + 1;
  85.       a[4] = a[0];
  86.       a[5] = a[1];
  87.       a[6] = a[2];
  88.       a[7] = a[3];
  89.       generate(366);
  90.    }
  91. };
  92.